package oss

import (
	"github.com/aliyun/aliyun-oss-go-sdk/oss"
	"github.com/go-emix/utils"
	"io"
	"service/common/aliyun"
)

const (
	BucketName = ""

	DomainName = ""
)

var Client *oss.Client

func init() {
	var err error
	Client, err = oss.New(aliyun.Endpoint, aliyun.AccessKeyId, aliyun.AccessKeySecret)
	utils.PanicError(err)
}

func Put(key string, file io.Reader) error {
	bucket, err := Client.Bucket(BucketName)
	if err != nil {
		return err
	}
	return bucket.PutObject(key, file)
}
